package reduce

import "lambda"

func ReduceFully(term lambda.Term, env lambda.Environment) lambda.Primitive {
	for {
		if prim, ok := term.(lambda.Primitive); ok {
			return prim
		}
		term = term.Reduce(env)
	}
	panic("exit infinite loop")
}
